const test = require('ava');
const taishan = require('../dist/index');
const validator = require('../dist/libs/validator');
const format = require('../dist/libs/date/format');
const deepClone = require('../dist/libs/util/deepClone');
const uuid = require('../dist/libs/util/UUID');
const { UUID_TYPE } = require('../dist/libs/constant');

const testObj = {
  a: function () {
    console.log('a');
  },
  b: new Map([
    ['apples', 500],
    ['bananas', 300],
    ['oranges', 200]
  ]),
  c: {
    a: new Set(['a', 'b', 'c']),
    b: {
      a: [
        {
          a: ['1']
        }
      ]
    }
  }
};

const UUID = uuid(UUID_TYPE.NORMAL)({ len: 32, radix: 80 });
test('uuid: ' + UUID, t => {
  t.is(typeof UUID, 'string');
});

const { isNodeEnvironment } = require(`../dist/libs/environment`);
test('isNodeEnvironment: ' + isNodeEnvironment, t => {
  t.is(!!isNodeEnvironment, true);
});

const formatVal = format();
test('format: ' + formatVal, t => {
  t.is(typeof formatVal, 'string');
});

const isWebsite = validator.isWebsite('/codingRoot/teams/data_mgr/');
test('isWebsite: ' + isWebsite, t => {
  t.is(isWebsite, false);
});

const testObj2 = deepClone(testObj, false);
test('deepClone: ' + testObj2, t => {
  console.log({
    deepClone: testObj2
  });
  t.is(testObj2 === testObj, false);
});

console.log({
  taishan
});
